<?php

namespace App\Http\Controllers;

use App\Services\CommentService;
use Illuminate\Http\Request;

class CommentController extends Controller
{
    public function getList(CommentService $commentService)
    {
        $comments = $commentService->commentList($this->requests['novel_id'], $this->requests['page'] ?? 1);
        return renderSuccessJson($comments);
    }

    public function publishComment(CommentService $commentService)
    {
        $commentService->createComment($this->requests['novel_id'], $this->userId, $this->requests['content']);
        return renderSuccessJson();
    }
}
